UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWSc1m2K4wi/rR6xqJ6XkDqllyXZMV/pZlqZbvqNxGE=' 
WHERE 
  key_id = 'b246b779d0c9726c1bba249c540d111c6f3771042df4bbcf1977c1fc5c7efc6d' 
  AND (
    token = 'qWSc1m2K4wi/rR6xqJ6XkDqllyXZMV/pZlqZbvqNxGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032