UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aD4tfWfYGFIvjUu8Ao3YR3Z/811GiPx/shXJU35fIwA=' 
WHERE 
  key_id = '3528c3183e2451182d7a8afe809ad1eefe2f474ac862e212bdf748e33465f81e' 
  AND (
    token = 'aD4tfWfYGFIvjUu8Ao3YR3Z/811GiPx/shXJU35fIwA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035