UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ppkUuYBQM48AKaCJZBbD5VBSXAsrJx9AM8CgrjGGVQ4=' 
WHERE 
  key_id = '8644389194f300bb2fe1b4142ff4e67881ea46876a1bf09a5d54eaf1110aa96a' 
  AND (
    token = 'ppkUuYBQM48AKaCJZBbD5VBSXAsrJx9AM8CgrjGGVQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037