UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dp1lqyTzBVAFyB6c9HU2aF2PfvTUq+Uoa1e+LXTuzs4=' 
WHERE 
  key_id = 'aeed211f9533b5ca5bb1b81fbb5acc085a8c22c8ffbe5180130ab1aec82c487d' 
  AND (
    token = 'dp1lqyTzBVAFyB6c9HU2aF2PfvTUq+Uoa1e+LXTuzs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028