UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4XBFmRG4PgNX1YFnwSopjHGOdEiYPTzUBud2C5MRMcA=' 
WHERE 
  key_id = 'ef90769fec5b7574d31f1559a592f3501be7e7264bbe1a3f71333aae485c6fd8' 
  AND (
    token = '4XBFmRG4PgNX1YFnwSopjHGOdEiYPTzUBud2C5MRMcA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032