UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uTD/OqIyLVqKskulkuH9qmfd3ERIFtLUURAdqaZZ4GE=' 
WHERE 
  key_id = '58f91ec860be229b9ea0aa7df3ff45b9149786be50693a24d737a2597a33a346' 
  AND (
    token = 'uTD/OqIyLVqKskulkuH9qmfd3ERIFtLUURAdqaZZ4GE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027