UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aWy2EIY7vb6sKJeCXbkWolGvqf+Z8/Nwq7/f2mk8wm0=' 
WHERE 
  key_id = 'bdf4ec1466aa1a7360e20c2b6a2224c584358dea8870ba697b3da044f04c1511' 
  AND (
    token = 'aWy2EIY7vb6sKJeCXbkWolGvqf+Z8/Nwq7/f2mk8wm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040