UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vierWMwzx/DupvDPJ1GhHmrTSQs+mexGMm3OdpLL84U=' 
WHERE 
  key_id = 'e11d0375e7e54843443cec130acd09464b9f86f998576b6e90e95683e3fd535f' 
  AND (
    token = 'vierWMwzx/DupvDPJ1GhHmrTSQs+mexGMm3OdpLL84U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031