UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IBo0wnV/EBP4DoENq2OZefY97Gw76dDwlxWho8p6D2M=' 
WHERE 
  key_id = '9a5590feff1c4fc1778f77c966f6adbd12cac951d076f699b7b027a535d7e913' 
  AND (
    token = 'IBo0wnV/EBP4DoENq2OZefY97Gw76dDwlxWho8p6D2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038