UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'As+/wCfTGsCUyGAFeyhGJZRvgA3g5/3vzSTJB0OEs8E=' 
WHERE 
  key_id = '243020951d57a64d99edaa540540878faf5db0e5cd249f7e08c96446373c2635' 
  AND (
    token = 'As+/wCfTGsCUyGAFeyhGJZRvgA3g5/3vzSTJB0OEs8E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025