UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uir7UyKybJ8fbVic6+sYVDSPapdG0WgkMXsURksoTe0=' 
WHERE 
  key_id = 'd7fa98d1c136a46133d4faf735b282d3ed019b572e30d96e3c9c66963bc21319' 
  AND (
    token = 'uir7UyKybJ8fbVic6+sYVDSPapdG0WgkMXsURksoTe0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022