UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pFELymG2XzB57tHpAEW0ZbD1fE5y6qTmY3yniF2w95U=' 
WHERE 
  key_id = 'a58957dea10ff204d3a50711c226680b17410dfbdd61cac99baafa1eef45df22' 
  AND (
    token = 'pFELymG2XzB57tHpAEW0ZbD1fE5y6qTmY3yniF2w95U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030