UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0yXZ523j84GnrPv8CwmU0J+2dDjHCpr6y6KAfn3ZNtk=' 
WHERE 
  key_id = 'a63ac8fc9850d4c3c7c80f67c1858e78413bf50c358dc29482fa52fac6b642e9' 
  AND (
    token = '0yXZ523j84GnrPv8CwmU0J+2dDjHCpr6y6KAfn3ZNtk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026