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

Query time 0.00052