UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3jre9cmQOfG3aGYX4g53T8pSH1twNfy8U4+MsuJNkJU=' 
WHERE 
  key_id = 'dac4db423bb8455cdab78483dba3661aee0879ac74e38b68856468c16ed2fbd9' 
  AND (
    token = '3jre9cmQOfG3aGYX4g53T8pSH1twNfy8U4+MsuJNkJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031