UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'itMiXNUnbbftjtmVSUs2qWcpCTkfPgmFjPAWIeIVBX8=' 
WHERE 
  key_id = '4e82c5c2c692a51b0b7af30759d3207aee8a2d1edd73900bf577f77baf20cec7' 
  AND (
    token = 'itMiXNUnbbftjtmVSUs2qWcpCTkfPgmFjPAWIeIVBX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017