UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BBtNa8dkOPz+LEoq+mH/TecCztdJkMGdwvf2wzBzluw=' 
WHERE 
  key_id = '44e6d1c5ff9c752e2d256e84ad2c0f9f78b6b26e32ef8d32ab3a3818ff37002f' 
  AND (
    token = 'BBtNa8dkOPz+LEoq+mH/TecCztdJkMGdwvf2wzBzluw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026