UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'USU8EHPA1XU15ZZ2vSUqzDMbmXrzcmaUCWZNvsQsuHw=' 
WHERE 
  key_id = '120d846163c824afd2273022ef47f3c546d56eb791e184b69abf5ab421915e3b' 
  AND (
    token = 'USU8EHPA1XU15ZZ2vSUqzDMbmXrzcmaUCWZNvsQsuHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049