UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mTmWJ2/Jr/AA7nyB7OskAKt1mtRb3lMuAkhoxsmaSO8=' 
WHERE 
  key_id = '52e57cd1ac2d1630d9f796b92e664002e80da98aa3266a064e2fb376a6d6102d' 
  AND (
    token = 'mTmWJ2/Jr/AA7nyB7OskAKt1mtRb3lMuAkhoxsmaSO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027