UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JI+QyCdhBI/v3AHHhbOC1yq7U+k7DXexsUaCAIPPIg4=' 
WHERE 
  key_id = 'e59e8c2f6d17d5585946ddd566f1782e174cf7f87a589afc6054def96e793ae4' 
  AND (
    token = 'JI+QyCdhBI/v3AHHhbOC1yq7U+k7DXexsUaCAIPPIg4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030