UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HwoRPyc09AgO/z3nfUt8IIeEL6QckRBcWRK1IiWdt8I=' 
WHERE 
  key_id = '5d7a3e8b1c500b708f4c541d2c170d60b04d441827594589830f077e19003fb8' 
  AND (
    token = 'HwoRPyc09AgO/z3nfUt8IIeEL6QckRBcWRK1IiWdt8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028