UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cJL9J5yyI07LhLwpzhjJdFPJyJxfvF5AKdRVO2bre94=' 
WHERE 
  key_id = '0c4188db853d7749313f8e37f263d3702b2d4b424011516343fed4e0fd476071' 
  AND (
    token = 'cJL9J5yyI07LhLwpzhjJdFPJyJxfvF5AKdRVO2bre94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038