UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1fjfgCkh70ZiQRg5LX5NwzurdQUWDlMKzSJBR2P4Sfg=' 
WHERE 
  key_id = '20bc89d4c60fd731f650feb348048eeaa3754e4bf98e58b49fe31189ad81bb3e' 
  AND (
    token = '1fjfgCkh70ZiQRg5LX5NwzurdQUWDlMKzSJBR2P4Sfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037