UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oRyOYYTlc0ALfMOa2PqoxPKJyuX4lZwUm1ypBzSM6OU=' 
WHERE 
  key_id = '46224db08eedd367a9da8533cd7e948b9f8beeed963b60aad25f82e729c49a64' 
  AND (
    token = 'oRyOYYTlc0ALfMOa2PqoxPKJyuX4lZwUm1ypBzSM6OU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045