UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BTfPzLVTGNUcdvbpAzrbFGdDIEn4Qgmgtu6yWtGpdOI=' 
WHERE 
  key_id = '9274d6f0bc5239ee0115cf3c35b43a4d92c0882e0c75cce10c3b8c3594341787' 
  AND (
    token = 'BTfPzLVTGNUcdvbpAzrbFGdDIEn4Qgmgtu6yWtGpdOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023