UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '79e6Y96zzCV20jnGbkJgCd3aeHhyH/CoWzYqUBPs3bo=' 
WHERE 
  key_id = '9eb693ce546df7685103f7b247011985d9e829e45f6df86b8905c1a1d0ef5255' 
  AND (
    token = '79e6Y96zzCV20jnGbkJgCd3aeHhyH/CoWzYqUBPs3bo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032