UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0BF5JyDHCVzJgKsvKFIGvvDv9YYutrxG+q7Dzbe55dM=' 
WHERE 
  key_id = 'bb1dff6680d8d0bf08b3b18645213ca4c1df2407979b99e48b53573306d48046' 
  AND (
    token = '0BF5JyDHCVzJgKsvKFIGvvDv9YYutrxG+q7Dzbe55dM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028