UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o++6x4iMr94XN0ygzWJJSjHOltNR2O8sQFI7bImBLX4=' 
WHERE 
  key_id = 'eab72e8fc550b50a65dbb671616a17f9c6a28d39472d0477da856a951146626f' 
  AND (
    token = 'o++6x4iMr94XN0ygzWJJSjHOltNR2O8sQFI7bImBLX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017