UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BMPem0Eucf/u4H4P0on7OL4cXhB9lB+Ishh0khwIigo=' 
WHERE 
  key_id = 'f4f92a809ef9a4bdf0995a865233d3f656b0265251e3d995b975fab04003f62d' 
  AND (
    token = 'BMPem0Eucf/u4H4P0on7OL4cXhB9lB+Ishh0khwIigo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041