UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y6qj52kA+ciixujnGjghAWut/Tla8yjcB038DMK+jH8=' 
WHERE 
  key_id = '2cf317d42c0b5ef40914e62a2dafd916dde3fa92e9c0045261be2484c93035e5' 
  AND (
    token = 'Y6qj52kA+ciixujnGjghAWut/Tla8yjcB038DMK+jH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021