UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TDz50kbqjaMSRqTFfNJqDUI62eYMFIKi77zphK99Wug=' 
WHERE 
  key_id = '5c45776eb6752c1e278e50d3bc93db37974396f0ebcab49cbcd7e3a2566141a0' 
  AND (
    token = 'TDz50kbqjaMSRqTFfNJqDUI62eYMFIKi77zphK99Wug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057