UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '63KiL7sPJmCT7ebOSw4Qa1TQYtjtChosfwjb+uwy468=' 
WHERE 
  key_id = '0e53f46e2342bd0f01097d53c949082e62e2df63786aefe5534a2feb7dd52613' 
  AND (
    token = '63KiL7sPJmCT7ebOSw4Qa1TQYtjtChosfwjb+uwy468=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045